package cn.tedu;

import cn.tedu.di.Dept;
import cn.tedu.di.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author SWJ
 * @create 2021-07-17 10:37
 */
public class test {
    public static void main(String[] args) {
        //1.读取核心内容配置文件
        ApplicationContext ac =
                new ClassPathXmlApplicationContext
                        ("spring-config.xml");

        //2.根据类型，获取对象,User类由于大写 在获取类型时候只能是小写
        //user所以要强制类型转换
        User u = (User) ac.getBean("user");
        System.out.println(u);
        Dept d = (Dept) ac.getBean("dept");
        System.out.println(d);

//        User{name='jack'}
//        Dept{sname='Student', t=User{name='jack'}}

    }

}
